package es.ceura.wilder.actions;

import java.util.HashMap;

/**
 *
 * @author Jorge Madrid
 */
public enum Actions {

    INSTANCE;
    private HashMap<String, ActionType> actions;
    private static final String GET = "GET",
            POST = "POST";

    private Actions() {
        actions = new HashMap<>();

        actions.put(GET, ActionType.GET);
        actions.put(POST, ActionType.POST);
    }

    public ActionType getAction(String action) throws UnsuportedActionException {
        ActionType actionType = actions.get(action);
        if (actionType == null) {
            throw new UnsuportedActionException("Action not supported by server...: " + action);
        }
        return actionType;
    }
}
